package com.zjw.yyyy2021.mmdd0926;

import java.util.LinkedHashMap;
import java.util.LinkedList;

/**
 * <p>TODO</p>
 *
 * @author 郑大仙丶
 * @version V1.0.0
 * @date 2021/9/26 18:56
 */
public class MMdd0926 {

    public static int getSum(int a, int b) {
        while(b != 0){
            int jw = (a & b) << 1;
            a = a ^ b;
            b = jw;
        }
        return a;
        /*
        b0001 0001
        a0000 1111

        b0000 0010
        a0001 1110

        b0000 0100
        a0001 1100

        b0000 1000
        a0001 1000

        b0001 0000
        a0001 0000

        b0010 0000
        a0000 0000

        b0000 0000
        a0010 0000
         */
    }


    public static void main(String[] args) {
        System.out.println(MMdd0926.getSum(999, 17));
    }

}
class LRUCache {
    LinkedHashMap<Integer,Integer> map = null;
    LinkedList list = new LinkedList();
    int capacity = 0;

    public LRUCache(int capacity) {
        this.capacity = capacity;
        map = new LinkedHashMap(capacity);
    }

    public int get(int key) {
        if(map.containsKey(key)){
            Integer value = map.remove(key);
            map.put(key,value);
            return value;
        }else{
            return -1;
        }

    }

    public void put(int key, int value) {
        if(map.containsKey(key)){
            map.remove(key);
        }else if(map.size() == capacity){
            map.remove(map.entrySet().iterator().next().getKey());
        }
        map.put(key,value);
    }
}